{% extends "base.html" %}

{% block title %}编辑个人资料{% endblock %}

{% block content %}
<div class="container my-5">
    <div class="card">
        <div class="card-header bg-primary text-white">
            <h3>编辑个人资料</h3>
        </div>
        <div class="card-body">
            <form method="POST" action="{{ url_for('edit_profile') }}">  <!-- 修改此处 -->
                {{ form.hidden_tag() }}
                <div class="form-group mb-3">
                    <label for="username">用户名</label>
                    {{ form.username(class="form-control", id="username") }}
                    {% for error in form.username.errors %}
                    <small class="text-danger">{{ error }}</small>
                    {% endfor %}
                </div>
                <div class="form-group mb-3">
                    <label for="email">邮箱</label>
                    {{ form.email(class="form-control", id="email") }}
                    {% for error in form.email.errors %}
                    <small class="text-danger">{{ error }}</small>
                    {% endfor %}
                </div>
                <div class="form-group mb-3">
                    <label for="phone">手机号</label>
                    {{ form.phone(class="form-control", id="phone") }}
                    {% for error in form.phone.errors %}
                    <small class="text-danger">{{ error }}</small>
                    {% endfor %}
                </div>
                <div class="form-group mb-3">
                    <label for="password">新密码（若不修改请留空）</label>
                    {{ form.password(class="form-control", id="password") }}
                    {% for error in form.password.errors %}
                    <small class="text-danger">{{ error }}</small>
                    {% endfor %}
                </div>
                <div class="form-group mb-3">
                    <label for="confirm_password">确认新密码</label>
                    {{ form.confirm_password(class="form-control", id="confirm_password") }}
                    {% for error in form.confirm_password.errors %}
                    <small class="text-danger">{{ error }}</small>
                    {% endfor %}
                </div>
                <button type="submit" class="btn btn-primary">保存更改</button>
                <a href="{{ url_for('profile') }}" class="btn btn-secondary">取消</a>
            </form>
        </div>
    </div>
</div>
{% endblock %}